<!DOCTYPE html>
<html>
<head>
	<style type="text/css">
	*{margin: 0;padding: 0}

	</style>
</head>

<body>
	<!-- <img id="img" src="http://img3.imgtn.bdimg.com/it/u=1577957864,2967915305&fm=26&gp=0.jpg"> -->
	<canvas id="cans1" width="800" height="400"></canvas>

  <script>
		window.onload=function(){
			let cans=document.getElementById('cans1');
			let cs=cans.getContext('2d');
			// let oimg=document.getElementById('img');
			let oimg=document.createElement('img');//两种写法效果一样
			// let oimg=new Image();
				oimg.src='kulou.jpg';

				oimg.onload=function(){

					cs.drawImage(oimg,43,20,60,110,200,200,60,110)
				}
			
		}
			
  </script>
</body>
</html>
